From a226d75cbc55d5cf6b433565af2de1dbf89c9232 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 11 May 2023 16:10:52 +0100
Subject: [PATCH] bcm2835-smi: Use phys addresses for slave DMA config

Contrary to what struct snd_dmaengine_dai_dma_data suggests, the
configuration of addresses of DMA slave interfaces should be done in
CPU physical addresses.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 drivers/misc/bcm2835_smi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/drivers/misc/bcm2835_smi.c
+++ b/drivers/misc/bcm2835_smi.c
@@ -64,7 +64,7 @@ struct bcm2835_smi_instance {
 	struct device *dev;
 	struct smi_settings settings;
 	__iomem void *smi_regs_ptr;
-	dma_addr_t smi_regs_busaddr;
+	phys_addr_t smi_regs_busaddr;
 
 	struct dma_chan *dma_chan;
 	struct dma_slave_config dma_config;
@@ -858,7 +858,6 @@ static int bcm2835_smi_probe(struct plat
 	struct device_node *node = dev->of_node;
 	struct resource *ioresource;
 	struct bcm2835_smi_instance *inst;
-	const __be32 *addr;
 
 	/* We require device tree support */
 	if (!node)
@@ -872,14 +871,13 @@ static int bcm2835_smi_probe(struct plat
 	inst->dev = dev;
 	spin_lock_init(&inst->transaction_lock);
 
-	ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource);
+	inst->smi_regs_ptr = devm_platform_get_and_ioremap_resource(pdev, 0,
+								    &ioresource);
 	if (IS_ERR(inst->smi_regs_ptr)) {
 		err = PTR_ERR(inst->smi_regs_ptr);
 		goto err;
 	}
-	addr = of_get_address(node, 0, NULL, NULL);
-	inst->smi_regs_busaddr = be32_to_cpu(*addr);
+	inst->smi_regs_busaddr = ioresource->start;
 
 	err = bcm2835_smi_dma_setup(inst);
 	if (err)
